<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数</title>
</head>
<script>
    function table(rows=3,cols=4,color="red"){
        document.write(`<table border=1 bordercolor=${color}>`)
        for (let i = 1; i <= rows; i++) {
            document.write("<tr>")
            for (let j = 1; j <= cols; j++) {
                document.write(`<td>1</td>`);
            }
            document.write("</tr>")
        }
        document.write("</table>")
    }
    table();
    table(5,6,"blue");
    table(4,undefined,"black");
    
    (function (){
        console.log("self");
    })();
    
</script>
<style>
    .onclick{
        width: 200px;
        height: 200px;
        background-color: aquamarine;
    }
</style>
<body>
    <div class="onclick" onclick="fun()"></div>
    <script>
        let fun = function(){
        alert(1);
    }
    </script>
</body>
</html>